﻿#include "ingrep.h"
#include "ui_ingrep.h"

#include <QMessageBox>

ingrep::ingrep(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::ingrep)
{
    ui->setupUi(this);
    ui->labelError->setVisible(false);
}

ingrep::~ingrep()
{
    delete ui;
}

void ingrep::on_btnInGrep_clicked()
{
    if(ui->getGrep->text().isEmpty() || ui->letID->text().isEmpty() || ui->letName->text().isEmpty())
    {
        ui->labelError->setVisible(true);
        return;
    }
    else
    {
        ui->labelError->setVisible(false);
    }

    ChatDialog *chat = new ChatDialog(ui->letName->text(), ui->letID->text().toInt(), ui->getGrep->text().toInt(), this);

    chat->show();

    ui->getGrep->clear();
    ui->letID->clear();
    ui->letName->clear();
}
